//
//  UILabel+Extension.swift
//  CYSinaWB
//
//  Created by mac on 16/2/16.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

extension UILabel {
    
    class func factoryLabel(text: String,fontSize: CGFloat,textColor: UIColor,alignment: NSTextAlignment = .Center) ->UILabel {
        let l = UILabel()
        l.text = text
        l.font = UIFont.systemFontOfSize(fontSize)
        l.textColor = textColor
        l.numberOfLines = 0
        l.textAlignment = alignment
        l.sizeToFit()
        return l
    }
    
    //遍历的构造函数
    convenience init(text: String,fontSize: CGFloat,textColor: UIColor,alignment: NSTextAlignment = .Center) {
        self.init()
        self.text = text
        font = UIFont.systemFontOfSize(fontSize)
        self.textColor = textColor
        numberOfLines = 0
        textAlignment = alignment
        sizeToFit()
    }
}
